var qt = Object.defineProperty;
var Pe = Object.getOwnPropertySymbols;
var mt = Object.prototype.hasOwnProperty, vt = Object.prototype.propertyIsEnumerable;
var gt = (t, e, n) => e in t ? qt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, se = (t, e) => {
  for (var n in e || (e = {}))
    mt.call(e, n) && gt(t, n, e[n]);
  if (Pe)
    for (var n of Pe(e))
      vt.call(e, n) && gt(t, n, e[n]);
  return t;
};
var Ve = (t, e) => {
  var n = {};
  for (var o in t)
    mt.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
  if (t != null && Pe)
    for (var o of Pe(t))
      e.indexOf(o) < 0 && vt.call(t, o) && (n[o] = t[o]);
  return n;
};
import { getCurrentInstance as ft, unref as V, watch as Kt, onUnmounted as Jt, onMounted as Zt, isRef as Qt, defineComponent as en, useAttrs as tn, computed as bt, toRefs as nn, ref as on, reactive as rn, h as an, isProxy as ln } from "vue";
const xt = "[vue-draggable-plus]: ";
function sn(t) {
  console.warn(xt + t);
}
function un(t) {
  console.error(xt + t);
}
function yt(t, e, n) {
  return n >= 0 && n < t.length && t.splice(n, 0, t.splice(e, 1)[0]), t;
}
function fn(t) {
  return t.replace(/-(\w)/g, (e, n) => n ? n.toUpperCase() : "");
}
function cn(t) {
  return Object.keys(t).reduce((e, n) => (typeof t[n] != "undefined" && (e[fn(n)] = t[n]), e), {});
}
function dn(t, e) {
  if (Array.isArray(t))
    return t.splice(e, 1);
}
function hn(t, e, n) {
  if (Array.isArray(t))
    return t.splice(e, 0, n);
}
function pn(t) {
  return typeof t == "undefined";
}
function gn(t) {
  return typeof t == "string";
}
function wt(t, e, n) {
  const o = t.children[n];
  t.insertBefore(e, o);
}
function $e(t) {
  t.parentNode && t.parentNode.removeChild(t);
}
function mn(t, e = document) {
  var o;
  let n = null;
  return typeof (e == null ? void 0 : e.querySelector) == "function" ? n = (o = e == null ? void 0 : e.querySelector) == null ? void 0 : o.call(e, t) : n = document.querySelector(t), n || sn(`Element not found: ${t}`), n;
}
function vn(t, e, n = null) {
  return function(...o) {
    return t.apply(n, o), e.apply(n, o);
  };
}
function bn(t, e) {
  const n = se({}, t);
  return Object.keys(e).forEach((o) => {
    n[o] ? n[o] = vn(t[o], e[o]) : n[o] = e[o];
  }), n;
}
function yn(t) {
  return t instanceof HTMLElement;
}
function wn(t, e) {
  Object.keys(t).forEach((n) => {
    e(n, t[n]);
  });
}
/**!
 * Sortable 1.15.0
 * @author	RubaXa   <trash@rubaxa.org>
 * @author	owenm    <owen23355@gmail.com>
 * @license MIT
 */
function Et(t, e) {
  var n = Object.keys(t);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(t);
    e && (o = o.filter(function(r) {
      return Object.getOwnPropertyDescriptor(t, r).enumerable;
    })), n.push.apply(n, o);
  }
  return n;
}
function J(t) {
  for (var e = 1; e < arguments.length; e++) {
    var n = arguments[e] != null ? arguments[e] : {};
    e % 2 ? Et(Object(n), !0).forEach(function(o) {
      En(t, o, n[o]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Et(Object(n)).forEach(function(o) {
      Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
    });
  }
  return t;
}
function Re(t) {
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Re = function(e) {
    return typeof e;
  } : Re = function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  }, Re(t);
}
function En(t, e, n) {
  return e in t ? Object.defineProperty(t, e, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : t[e] = n, t;
}
function te() {
  return te = Object.assign || function(t) {
    for (var e = 1; e < arguments.length; e++) {
      var n = arguments[e];
      for (var o in n)
        Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
    }
    return t;
  }, te.apply(this, arguments);
}
function Sn(t, e) {
  if (t == null)
    return {};
  var n = {}, o = Object.keys(t), r, i;
  for (i = 0; i < o.length; i++)
    r = o[i], !(e.indexOf(r) >= 0) && (n[r] = t[r]);
  return n;
}
function Dn(t, e) {
  if (t == null)
    return {};
  var n = Sn(t, e), o, r;
  if (Object.getOwnPropertySymbols) {
    var i = Object.getOwnPropertySymbols(t);
    for (r = 0; r < i.length; r++)
      o = i[r], !(e.indexOf(o) >= 0) && Object.prototype.propertyIsEnumerable.call(t, o) && (n[o] = t[o]);
  }
  return n;
}
var _n = "1.15.0";
function ee(t) {
  if (typeof window != "undefined" && window.navigator)
    return !!/* @__PURE__ */ navigator.userAgent.match(t);
}
var ne = ee(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i), Ie = ee(/Edge/i), St = ee(/firefox/i), De = ee(/safari/i) && !ee(/chrome/i) && !ee(/android/i), Mt = ee(/iP(ad|od|hone)/i), Ft = ee(/chrome/i) && ee(/android/i), Xt = {
  capture: !1,
  passive: !1
};
function S(t, e, n) {
  t.addEventListener(e, n, !ne && Xt);
}
function E(t, e, n) {
  t.removeEventListener(e, n, !ne && Xt);
}
function Le(t, e) {
  if (e) {
    if (e[0] === ">" && (e = e.substring(1)), t)
      try {
        if (t.matches)
          return t.matches(e);
        if (t.msMatchesSelector)
          return t.msMatchesSelector(e);
        if (t.webkitMatchesSelector)
          return t.webkitMatchesSelector(e);
      } catch (n) {
        return !1;
      }
    return !1;
  }
}
function Tn(t) {
  return t.host && t !== document && t.host.nodeType ? t.host : t.parentNode;
}
function q(t, e, n, o) {
  if (t) {
    n = n || document;
    do {
      if (e != null && (e[0] === ">" ? t.parentNode === n && Le(t, e) : Le(t, e)) || o && t === n)
        return t;
      if (t === n)
        break;
    } while (t = Tn(t));
  }
  return null;
}
var Dt = /\s+/g;
function L(t, e, n) {
  if (t && e)
    if (t.classList)
      t.classList[n ? "add" : "remove"](e);
    else {
      var o = (" " + t.className + " ").replace(Dt, " ").replace(" " + e + " ", " ");
      t.className = (o + (n ? " " + e : "")).replace(Dt, " ");
    }
}
function h(t, e, n) {
  var o = t && t.style;
  if (o) {
    if (n === void 0)
      return document.defaultView && document.defaultView.getComputedStyle ? n = document.defaultView.getComputedStyle(t, "") : t.currentStyle && (n = t.currentStyle), e === void 0 ? n : n[e];
    !(e in o) && e.indexOf("webkit") === -1 && (e = "-webkit-" + e), o[e] = n + (typeof n == "string" ? "" : "px");
  }
}
function me(t, e) {
  var n = "";
  if (typeof t == "string")
    n = t;
  else
    do {
      var o = h(t, "transform");
      o && o !== "none" && (n = o + " " + n);
    } while (!e && (t = t.parentNode));
  var r = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
  return r && new r(n);
}
function Rt(t, e, n) {
  if (t) {
    var o = t.getElementsByTagName(e), r = 0, i = o.length;
    if (n)
      for (; r < i; r++)
        n(o[r], r);
    return o;
  }
  return [];
}
function K() {
  var t = document.scrollingElement;
  return t || document.documentElement;
}
function N(t, e, n, o, r) {
  if (!(!t.getBoundingClientRect && t !== window)) {
    var i, a, l, s, u, d, c;
    if (t !== window && t.parentNode && t !== K() ? (i = t.getBoundingClientRect(), a = i.top, l = i.left, s = i.bottom, u = i.right, d = i.height, c = i.width) : (a = 0, l = 0, s = window.innerHeight, u = window.innerWidth, d = window.innerHeight, c = window.innerWidth), (e || n) && t !== window && (r = r || t.parentNode, !ne))
      do
        if (r && r.getBoundingClientRect && (h(r, "transform") !== "none" || n && h(r, "position") !== "static")) {
          var v = r.getBoundingClientRect();
          a -= v.top + parseInt(h(r, "border-top-width")), l -= v.left + parseInt(h(r, "border-left-width")), s = a + i.height, u = l + i.width;
          break;
        }
      while (r = r.parentNode);
    if (o && t !== window) {
      var y = me(r || t), b = y && y.a, w = y && y.d;
      y && (a /= w, l /= b, c /= b, d /= w, s = a + d, u = l + c);
    }
    return {
      top: a,
      left: l,
      bottom: s,
      right: u,
      width: c,
      height: d
    };
  }
}
function _t(t, e, n) {
  for (var o = ae(t, !0), r = N(t)[e]; o; ) {
    var i = N(o)[n], a = void 0;
    if (n === "top" || n === "left" ? a = r >= i : a = r <= i, !a)
      return o;
    if (o === K())
      break;
    o = ae(o, !1);
  }
  return !1;
}
function ve(t, e, n, o) {
  for (var r = 0, i = 0, a = t.children; i < a.length; ) {
    if (a[i].style.display !== "none" && a[i] !== p.ghost && (o || a[i] !== p.dragged) && q(a[i], n.draggable, t, !1)) {
      if (r === e)
        return a[i];
      r++;
    }
    i++;
  }
  return null;
}
function ct(t, e) {
  for (var n = t.lastElementChild; n && (n === p.ghost || h(n, "display") === "none" || e && !Le(n, e)); )
    n = n.previousElementSibling;
  return n || null;
}
function z(t, e) {
  var n = 0;
  if (!t || !t.parentNode)
    return -1;
  for (; t = t.previousElementSibling; )
    t.nodeName.toUpperCase() !== "TEMPLATE" && t !== p.clone && (!e || Le(t, e)) && n++;
  return n;
}
function Tt(t) {
  var e = 0, n = 0, o = K();
  if (t)
    do {
      var r = me(t), i = r.a, a = r.d;
      e += t.scrollLeft * i, n += t.scrollTop * a;
    } while (t !== o && (t = t.parentNode));
  return [e, n];
}
function On(t, e) {
  for (var n in t)
    if (t.hasOwnProperty(n)) {
      for (var o in e)
        if (e.hasOwnProperty(o) && e[o] === t[n][o])
          return Number(n);
    }
  return -1;
}
function ae(t, e) {
  if (!t || !t.getBoundingClientRect)
    return K();
  var n = t, o = !1;
  do
    if (n.clientWidth < n.scrollWidth || n.clientHeight < n.scrollHeight) {
      var r = h(n);
      if (n.clientWidth < n.scrollWidth && (r.overflowX == "auto" || r.overflowX == "scroll") || n.clientHeight < n.scrollHeight && (r.overflowY == "auto" || r.overflowY == "scroll")) {
        if (!n.getBoundingClientRect || n === document.body)
          return K();
        if (o || e)
          return n;
        o = !0;
      }
    }
  while (n = n.parentNode);
  return K();
}
function Cn(t, e) {
  if (t && e)
    for (var n in e)
      e.hasOwnProperty(n) && (t[n] = e[n]);
  return t;
}
function qe(t, e) {
  return Math.round(t.top) === Math.round(e.top) && Math.round(t.left) === Math.round(e.left) && Math.round(t.height) === Math.round(e.height) && Math.round(t.width) === Math.round(e.width);
}
var _e;
function Yt(t, e) {
  return function() {
    if (!_e) {
      var n = arguments, o = this;
      n.length === 1 ? t.call(o, n[0]) : t.apply(o, n), _e = setTimeout(function() {
        _e = void 0;
      }, e);
    }
  };
}
function In() {
  clearTimeout(_e), _e = void 0;
}
function kt(t, e, n) {
  t.scrollLeft += e, t.scrollTop += n;
}
function Bt(t) {
  var e = window.Polymer, n = window.jQuery || window.Zepto;
  return e && e.dom ? e.dom(t).cloneNode(!0) : n ? n(t).clone(!0)[0] : t.cloneNode(!0);
}
var G = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
function An() {
  var t = [], e;
  return {
    captureAnimationState: function() {
      if (t = [], !!this.options.animation) {
        var o = [].slice.call(this.el.children);
        o.forEach(function(r) {
          if (!(h(r, "display") === "none" || r === p.ghost)) {
            t.push({
              target: r,
              rect: N(r)
            });
            var i = J({}, t[t.length - 1].rect);
            if (r.thisAnimationDuration) {
              var a = me(r, !0);
              a && (i.top -= a.f, i.left -= a.e);
            }
            r.fromRect = i;
          }
        });
      }
    },
    addAnimationState: function(o) {
      t.push(o);
    },
    removeAnimationState: function(o) {
      t.splice(On(t, {
        target: o
      }), 1);
    },
    animateAll: function(o) {
      var r = this;
      if (!this.options.animation) {
        clearTimeout(e), typeof o == "function" && o();
        return;
      }
      var i = !1, a = 0;
      t.forEach(function(l) {
        var s = 0, u = l.target, d = u.fromRect, c = N(u), v = u.prevFromRect, y = u.prevToRect, b = l.rect, w = me(u, !0);
        w && (c.top -= w.f, c.left -= w.e), u.toRect = c, u.thisAnimationDuration && qe(v, c) && !qe(d, c) && // Make sure animatingRect is on line between toRect & fromRect
        (b.top - c.top) / (b.left - c.left) === (d.top - c.top) / (d.left - c.left) && (s = Pn(b, v, y, r.options)), qe(c, d) || (u.prevFromRect = d, u.prevToRect = c, s || (s = r.options.animation), r.animate(u, b, c, s)), s && (i = !0, a = Math.max(a, s), clearTimeout(u.animationResetTimer), u.animationResetTimer = setTimeout(function() {
          u.animationTime = 0, u.prevFromRect = null, u.fromRect = null, u.prevToRect = null, u.thisAnimationDuration = null;
        }, s), u.thisAnimationDuration = s);
      }), clearTimeout(e), i ? e = setTimeout(function() {
        typeof o == "function" && o();
      }, a) : typeof o == "function" && o(), t = [];
    },
    animate: function(o, r, i, a) {
      if (a) {
        h(o, "transition", ""), h(o, "transform", "");
        var l = me(this.el), s = l && l.a, u = l && l.d, d = (r.left - i.left) / (s || 1), c = (r.top - i.top) / (u || 1);
        o.animatingX = !!d, o.animatingY = !!c, h(o, "transform", "translate3d(" + d + "px," + c + "px,0)"), this.forRepaintDummy = Nn(o), h(o, "transition", "transform " + a + "ms" + (this.options.easing ? " " + this.options.easing : "")), h(o, "transform", "translate3d(0,0,0)"), typeof o.animated == "number" && clearTimeout(o.animated), o.animated = setTimeout(function() {
          h(o, "transition", ""), h(o, "transform", ""), o.animated = !1, o.animatingX = !1, o.animatingY = !1;
        }, a);
      }
    }
  };
}
function Nn(t) {
  return t.offsetWidth;
}
function Pn(t, e, n, o) {
  return Math.sqrt(Math.pow(e.top - t.top, 2) + Math.pow(e.left - t.left, 2)) / Math.sqrt(Math.pow(e.top - n.top, 2) + Math.pow(e.left - n.left, 2)) * o.animation;
}
var de = [], Ke = {
  initializeByDefault: !0
}, Ae = {
  mount: function(e) {
    for (var n in Ke)
      Ke.hasOwnProperty(n) && !(n in e) && (e[n] = Ke[n]);
    de.forEach(function(o) {
      if (o.pluginName === e.pluginName)
        throw "Sortable: Cannot mount plugin ".concat(e.pluginName, " more than once");
    }), de.push(e);
  },
  pluginEvent: function(e, n, o) {
    var r = this;
    this.eventCanceled = !1, o.cancel = function() {
      r.eventCanceled = !0;
    };
    var i = e + "Global";
    de.forEach(function(a) {
      n[a.pluginName] && (n[a.pluginName][i] && n[a.pluginName][i](J({
        sortable: n
      }, o)), n.options[a.pluginName] && n[a.pluginName][e] && n[a.pluginName][e](J({
        sortable: n
      }, o)));
    });
  },
  initializePlugins: function(e, n, o, r) {
    de.forEach(function(l) {
      var s = l.pluginName;
      if (!(!e.options[s] && !l.initializeByDefault)) {
        var u = new l(e, n, e.options);
        u.sortable = e, u.options = e.options, e[s] = u, te(o, u.defaults);
      }
    });
    for (var i in e.options)
      if (e.options.hasOwnProperty(i)) {
        var a = this.modifyOption(e, i, e.options[i]);
        typeof a != "undefined" && (e.options[i] = a);
      }
  },
  getEventProperties: function(e, n) {
    var o = {};
    return de.forEach(function(r) {
      typeof r.eventProperties == "function" && te(o, r.eventProperties.call(n[r.pluginName], e));
    }), o;
  },
  modifyOption: function(e, n, o) {
    var r;
    return de.forEach(function(i) {
      e[i.pluginName] && i.optionListeners && typeof i.optionListeners[n] == "function" && (r = i.optionListeners[n].call(e[i.pluginName], o));
    }), r;
  }
};
function xn(t) {
  var e = t.sortable, n = t.rootEl, o = t.name, r = t.targetEl, i = t.cloneEl, a = t.toEl, l = t.fromEl, s = t.oldIndex, u = t.newIndex, d = t.oldDraggableIndex, c = t.newDraggableIndex, v = t.originalEvent, y = t.putSortable, b = t.extraEventProperties;
  if (e = e || n && n[G], !!e) {
    var w, M = e.options, O = "on" + o.charAt(0).toUpperCase() + o.substr(1);
    window.CustomEvent && !ne && !Ie ? w = new CustomEvent(o, {
      bubbles: !0,
      cancelable: !0
    }) : (w = document.createEvent("Event"), w.initEvent(o, !0, !0)), w.to = a || n, w.from = l || n, w.item = r || n, w.clone = i, w.oldIndex = s, w.newIndex = u, w.oldDraggableIndex = d, w.newDraggableIndex = c, w.originalEvent = v, w.pullMode = y ? y.lastPutMode : void 0;
    var P = J(J({}, b), Ae.getEventProperties(o, e));
    for (var k in P)
      w[k] = P[k];
    n && n.dispatchEvent(w), M[O] && M[O].call(e, w);
  }
}
var Mn = ["evt"], Y = function(e, n) {
  var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, r = o.evt, i = Dn(o, Mn);
  Ae.pluginEvent.bind(p)(e, n, J({
    dragEl: f,
    parentEl: C,
    ghostEl: m,
    rootEl: _,
    nextEl: ce,
    lastDownEl: Ye,
    cloneEl: T,
    cloneHidden: ie,
    dragStarted: we,
    putSortable: x,
    activeSortable: p.active,
    originalEvent: r,
    oldIndex: ge,
    oldDraggableIndex: Te,
    newIndex: W,
    newDraggableIndex: re,
    hideGhostForTarget: Gt,
    unhideGhostForTarget: jt,
    cloneNowHidden: function() {
      ie = !0;
    },
    cloneNowShown: function() {
      ie = !1;
    },
    dispatchSortableEvent: function(l) {
      R({
        sortable: n,
        name: l,
        originalEvent: r
      });
    }
  }, i));
};
function R(t) {
  xn(J({
    putSortable: x,
    cloneEl: T,
    targetEl: f,
    rootEl: _,
    oldIndex: ge,
    oldDraggableIndex: Te,
    newIndex: W,
    newDraggableIndex: re
  }, t));
}
var f, C, m, _, ce, Ye, T, ie, ge, W, Te, re, xe, x, pe = !1, We = !1, Ge = [], ue, U, Je, Ze, Ot, Ct, we, he, Oe, Ce = !1, Me = !1, ke, X, Qe = [], it = !1, je = [], Ue = typeof document != "undefined", Fe = Mt, It = Ie || ne ? "cssFloat" : "float", Fn = Ue && !Ft && !Mt && "draggable" in document.createElement("div"), Ht = function() {
  if (Ue) {
    if (ne)
      return !1;
    var t = document.createElement("x");
    return t.style.cssText = "pointer-events:auto", t.style.pointerEvents === "auto";
  }
}(), Lt = function(e, n) {
  var o = h(e), r = parseInt(o.width) - parseInt(o.paddingLeft) - parseInt(o.paddingRight) - parseInt(o.borderLeftWidth) - parseInt(o.borderRightWidth), i = ve(e, 0, n), a = ve(e, 1, n), l = i && h(i), s = a && h(a), u = l && parseInt(l.marginLeft) + parseInt(l.marginRight) + N(i).width, d = s && parseInt(s.marginLeft) + parseInt(s.marginRight) + N(a).width;
  if (o.display === "flex")
    return o.flexDirection === "column" || o.flexDirection === "column-reverse" ? "vertical" : "horizontal";
  if (o.display === "grid")
    return o.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
  if (i && l.float && l.float !== "none") {
    var c = l.float === "left" ? "left" : "right";
    return a && (s.clear === "both" || s.clear === c) ? "vertical" : "horizontal";
  }
  return i && (l.display === "block" || l.display === "flex" || l.display === "table" || l.display === "grid" || u >= r && o[It] === "none" || a && o[It] === "none" && u + d > r) ? "vertical" : "horizontal";
}, Xn = function(e, n, o) {
  var r = o ? e.left : e.top, i = o ? e.right : e.bottom, a = o ? e.width : e.height, l = o ? n.left : n.top, s = o ? n.right : n.bottom, u = o ? n.width : n.height;
  return r === l || i === s || r + a / 2 === l + u / 2;
}, Rn = function(e, n) {
  var o;
  return Ge.some(function(r) {
    var i = r[G].options.emptyInsertThreshold;
    if (!(!i || ct(r))) {
      var a = N(r), l = e >= a.left - i && e <= a.right + i, s = n >= a.top - i && n <= a.bottom + i;
      if (l && s)
        return o = r;
    }
  }), o;
}, Wt = function(e) {
  function n(i, a) {
    return function(l, s, u, d) {
      var c = l.options.group.name && s.options.group.name && l.options.group.name === s.options.group.name;
      if (i == null && (a || c))
        return !0;
      if (i == null || i === !1)
        return !1;
      if (a && i === "clone")
        return i;
      if (typeof i == "function")
        return n(i(l, s, u, d), a)(l, s, u, d);
      var v = (a ? l : s).options.group.name;
      return i === !0 || typeof i == "string" && i === v || i.join && i.indexOf(v) > -1;
    };
  }
  var o = {}, r = e.group;
  (!r || Re(r) != "object") && (r = {
    name: r
  }), o.name = r.name, o.checkPull = n(r.pull, !0), o.checkPut = n(r.put), o.revertClone = r.revertClone, e.group = o;
}, Gt = function() {
  !Ht && m && h(m, "display", "none");
}, jt = function() {
  !Ht && m && h(m, "display", "");
};
Ue && !Ft && document.addEventListener("click", function(t) {
  if (We)
    return t.preventDefault(), t.stopPropagation && t.stopPropagation(), t.stopImmediatePropagation && t.stopImmediatePropagation(), We = !1, !1;
}, !0);
var fe = function(e) {
  if (f) {
    e = e.touches ? e.touches[0] : e;
    var n = Rn(e.clientX, e.clientY);
    if (n) {
      var o = {};
      for (var r in e)
        e.hasOwnProperty(r) && (o[r] = e[r]);
      o.target = o.rootEl = n, o.preventDefault = void 0, o.stopPropagation = void 0, n[G]._onDragOver(o);
    }
  }
}, Yn = function(e) {
  f && f.parentNode[G]._isOutsideThisEl(e.target);
};
function p(t, e) {
  if (!(t && t.nodeType && t.nodeType === 1))
    throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));
  this.el = t, this.options = e = te({}, e), t[G] = this;
  var n = {
    group: null,
    sort: !0,
    disabled: !1,
    store: null,
    handle: null,
    draggable: /^[uo]l$/i.test(t.nodeName) ? ">li" : ">*",
    swapThreshold: 1,
    // percentage; 0 <= x <= 1
    invertSwap: !1,
    // invert always
    invertedSwapThreshold: null,
    // will be set to same as swapThreshold if default
    removeCloneOnHide: !0,
    direction: function() {
      return Lt(t, this.options);
    },
    ghostClass: "sortable-ghost",
    chosenClass: "sortable-chosen",
    dragClass: "sortable-drag",
    ignore: "a, img",
    filter: null,
    preventOnFilter: !0,
    animation: 0,
    easing: null,
    setData: function(a, l) {
      a.setData("Text", l.textContent);
    },
    dropBubble: !1,
    dragoverBubble: !1,
    dataIdAttr: "data-id",
    delay: 0,
    delayOnTouchOnly: !1,
    touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
    forceFallback: !1,
    fallbackClass: "sortable-fallback",
    fallbackOnBody: !1,
    fallbackTolerance: 0,
    fallbackOffset: {
      x: 0,
      y: 0
    },
    supportPointer: p.supportPointer !== !1 && "PointerEvent" in window && !De,
    emptyInsertThreshold: 5
  };
  Ae.initializePlugins(this, t, n);
  for (var o in n)
    !(o in e) && (e[o] = n[o]);
  Wt(e);
  for (var r in this)
    r.charAt(0) === "_" && typeof this[r] == "function" && (this[r] = this[r].bind(this));
  this.nativeDraggable = e.forceFallback ? !1 : Fn, this.nativeDraggable && (this.options.touchStartThreshold = 1), e.supportPointer ? S(t, "pointerdown", this._onTapStart) : (S(t, "mousedown", this._onTapStart), S(t, "touchstart", this._onTapStart)), this.nativeDraggable && (S(t, "dragover", this), S(t, "dragenter", this)), Ge.push(this.el), e.store && e.store.get && this.sort(e.store.get(this) || []), te(this, An());
}
p.prototype = /** @lends Sortable.prototype */
{
  constructor: p,
  _isOutsideThisEl: function(e) {
    !this.el.contains(e) && e !== this.el && (he = null);
  },
  _getDirection: function(e, n) {
    return typeof this.options.direction == "function" ? this.options.direction.call(this, e, n, f) : this.options.direction;
  },
  _onTapStart: function(e) {
    if (e.cancelable) {
      var n = this, o = this.el, r = this.options, i = r.preventOnFilter, a = e.type, l = e.touches && e.touches[0] || e.pointerType && e.pointerType === "touch" && e, s = (l || e).target, u = e.target.shadowRoot && (e.path && e.path[0] || e.composedPath && e.composedPath()[0]) || s, d = r.filter;
      if (zn(o), !f && !(/mousedown|pointerdown/.test(a) && e.button !== 0 || r.disabled) && !u.isContentEditable && !(!this.nativeDraggable && De && s && s.tagName.toUpperCase() === "SELECT") && (s = q(s, r.draggable, o, !1), !(s && s.animated) && Ye !== s)) {
        if (ge = z(s), Te = z(s, r.draggable), typeof d == "function") {
          if (d.call(this, e, s, this)) {
            R({
              sortable: n,
              rootEl: u,
              name: "filter",
              targetEl: s,
              toEl: o,
              fromEl: o
            }), Y("filter", n, {
              evt: e
            }), i && e.cancelable && e.preventDefault();
            return;
          }
        } else if (d && (d = d.split(",").some(function(c) {
          if (c = q(u, c.trim(), o, !1), c)
            return R({
              sortable: n,
              rootEl: c,
              name: "filter",
              targetEl: s,
              fromEl: o,
              toEl: o
            }), Y("filter", n, {
              evt: e
            }), !0;
        }), d)) {
          i && e.cancelable && e.preventDefault();
          return;
        }
        r.handle && !q(u, r.handle, o, !1) || this._prepareDragStart(e, l, s);
      }
    }
  },
  _prepareDragStart: function(e, n, o) {
    var r = this, i = r.el, a = r.options, l = i.ownerDocument, s;
    if (o && !f && o.parentNode === i) {
      var u = N(o);
      if (_ = i, f = o, C = f.parentNode, ce = f.nextSibling, Ye = o, xe = a.group, p.dragged = f, ue = {
        target: f,
        clientX: (n || e).clientX,
        clientY: (n || e).clientY
      }, Ot = ue.clientX - u.left, Ct = ue.clientY - u.top, this._lastX = (n || e).clientX, this._lastY = (n || e).clientY, f.style["will-change"] = "all", s = function() {
        if (Y("delayEnded", r, {
          evt: e
        }), p.eventCanceled) {
          r._onDrop();
          return;
        }
        r._disableDelayedDragEvents(), !St && r.nativeDraggable && (f.draggable = !0), r._triggerDragStart(e, n), R({
          sortable: r,
          name: "choose",
          originalEvent: e
        }), L(f, a.chosenClass, !0);
      }, a.ignore.split(",").forEach(function(d) {
        Rt(f, d.trim(), et);
      }), S(l, "dragover", fe), S(l, "mousemove", fe), S(l, "touchmove", fe), S(l, "mouseup", r._onDrop), S(l, "touchend", r._onDrop), S(l, "touchcancel", r._onDrop), St && this.nativeDraggable && (this.options.touchStartThreshold = 4, f.draggable = !0), Y("delayStart", this, {
        evt: e
      }), a.delay && (!a.delayOnTouchOnly || n) && (!this.nativeDraggable || !(Ie || ne))) {
        if (p.eventCanceled) {
          this._onDrop();
          return;
        }
        S(l, "mouseup", r._disableDelayedDrag), S(l, "touchend", r._disableDelayedDrag), S(l, "touchcancel", r._disableDelayedDrag), S(l, "mousemove", r._delayedDragTouchMoveHandler), S(l, "touchmove", r._delayedDragTouchMoveHandler), a.supportPointer && S(l, "pointermove", r._delayedDragTouchMoveHandler), r._dragStartTimer = setTimeout(s, a.delay);
      } else
        s();
    }
  },
  _delayedDragTouchMoveHandler: function(e) {
    var n = e.touches ? e.touches[0] : e;
    Math.max(Math.abs(n.clientX - this._lastX), Math.abs(n.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1)) && this._disableDelayedDrag();
  },
  _disableDelayedDrag: function() {
    f && et(f), clearTimeout(this._dragStartTimer), this._disableDelayedDragEvents();
  },
  _disableDelayedDragEvents: function() {
    var e = this.el.ownerDocument;
    E(e, "mouseup", this._disableDelayedDrag), E(e, "touchend", this._disableDelayedDrag), E(e, "touchcancel", this._disableDelayedDrag), E(e, "mousemove", this._delayedDragTouchMoveHandler), E(e, "touchmove", this._delayedDragTouchMoveHandler), E(e, "pointermove", this._delayedDragTouchMoveHandler);
  },
  _triggerDragStart: function(e, n) {
    n = n || e.pointerType == "touch" && e, !this.nativeDraggable || n ? this.options.supportPointer ? S(document, "pointermove", this._onTouchMove) : n ? S(document, "touchmove", this._onTouchMove) : S(document, "mousemove", this._onTouchMove) : (S(f, "dragend", this), S(_, "dragstart", this._onDragStart));
    try {
      document.selection ? Be(function() {
        document.selection.empty();
      }) : window.getSelection().removeAllRanges();
    } catch (o) {
    }
  },
  _dragStarted: function(e, n) {
    if (pe = !1, _ && f) {
      Y("dragStarted", this, {
        evt: n
      }), this.nativeDraggable && S(document, "dragover", Yn);
      var o = this.options;
      !e && L(f, o.dragClass, !1), L(f, o.ghostClass, !0), p.active = this, e && this._appendGhost(), R({
        sortable: this,
        name: "start",
        originalEvent: n
      });
    } else
      this._nulling();
  },
  _emulateDragOver: function() {
    if (U) {
      this._lastX = U.clientX, this._lastY = U.clientY, Gt();
      for (var e = document.elementFromPoint(U.clientX, U.clientY), n = e; e && e.shadowRoot && (e = e.shadowRoot.elementFromPoint(U.clientX, U.clientY), e !== n); )
        n = e;
      if (f.parentNode[G]._isOutsideThisEl(e), n)
        do {
          if (n[G]) {
            var o = void 0;
            if (o = n[G]._onDragOver({
              clientX: U.clientX,
              clientY: U.clientY,
              target: e,
              rootEl: n
            }), o && !this.options.dragoverBubble)
              break;
          }
          e = n;
        } while (n = n.parentNode);
      jt();
    }
  },
  _onTouchMove: function(e) {
    if (ue) {
      var n = this.options, o = n.fallbackTolerance, r = n.fallbackOffset, i = e.touches ? e.touches[0] : e, a = m && me(m, !0), l = m && a && a.a, s = m && a && a.d, u = Fe && X && Tt(X), d = (i.clientX - ue.clientX + r.x) / (l || 1) + (u ? u[0] - Qe[0] : 0) / (l || 1), c = (i.clientY - ue.clientY + r.y) / (s || 1) + (u ? u[1] - Qe[1] : 0) / (s || 1);
      if (!p.active && !pe) {
        if (o && Math.max(Math.abs(i.clientX - this._lastX), Math.abs(i.clientY - this._lastY)) < o)
          return;
        this._onDragStart(e, !0);
      }
      if (m) {
        a ? (a.e += d - (Je || 0), a.f += c - (Ze || 0)) : a = {
          a: 1,
          b: 0,
          c: 0,
          d: 1,
          e: d,
          f: c
        };
        var v = "matrix(".concat(a.a, ",").concat(a.b, ",").concat(a.c, ",").concat(a.d, ",").concat(a.e, ",").concat(a.f, ")");
        h(m, "webkitTransform", v), h(m, "mozTransform", v), h(m, "msTransform", v), h(m, "transform", v), Je = d, Ze = c, U = i;
      }
      e.cancelable && e.preventDefault();
    }
  },
  _appendGhost: function() {
    if (!m) {
      var e = this.options.fallbackOnBody ? document.body : _, n = N(f, !0, Fe, !0, e), o = this.options;
      if (Fe) {
        for (X = e; h(X, "position") === "static" && h(X, "transform") === "none" && X !== document; )
          X = X.parentNode;
        X !== document.body && X !== document.documentElement ? (X === document && (X = K()), n.top += X.scrollTop, n.left += X.scrollLeft) : X = K(), Qe = Tt(X);
      }
      m = f.cloneNode(!0), L(m, o.ghostClass, !1), L(m, o.fallbackClass, !0), L(m, o.dragClass, !0), h(m, "transition", ""), h(m, "transform", ""), h(m, "box-sizing", "border-box"), h(m, "margin", 0), h(m, "top", n.top), h(m, "left", n.left), h(m, "width", n.width), h(m, "height", n.height), h(m, "opacity", "0.8"), h(m, "position", Fe ? "absolute" : "fixed"), h(m, "zIndex", "100000"), h(m, "pointerEvents", "none"), p.ghost = m, e.appendChild(m), h(m, "transform-origin", Ot / parseInt(m.style.width) * 100 + "% " + Ct / parseInt(m.style.height) * 100 + "%");
    }
  },
  _onDragStart: function(e, n) {
    var o = this, r = e.dataTransfer, i = o.options;
    if (Y("dragStart", this, {
      evt: e
    }), p.eventCanceled) {
      this._onDrop();
      return;
    }
    Y("setupClone", this), p.eventCanceled || (T = Bt(f), T.removeAttribute("id"), T.draggable = !1, T.style["will-change"] = "", this._hideClone(), L(T, this.options.chosenClass, !1), p.clone = T), o.cloneId = Be(function() {
      Y("clone", o), !p.eventCanceled && (o.options.removeCloneOnHide || _.insertBefore(T, f), o._hideClone(), R({
        sortable: o,
        name: "clone"
      }));
    }), !n && L(f, i.dragClass, !0), n ? (We = !0, o._loopId = setInterval(o._emulateDragOver, 50)) : (E(document, "mouseup", o._onDrop), E(document, "touchend", o._onDrop), E(document, "touchcancel", o._onDrop), r && (r.effectAllowed = "move", i.setData && i.setData.call(o, r, f)), S(document, "drop", o), h(f, "transform", "translateZ(0)")), pe = !0, o._dragStartId = Be(o._dragStarted.bind(o, n, e)), S(document, "selectstart", o), we = !0, De && h(document.body, "user-select", "none");
  },
  // Returns true - if no further action is needed (either inserted or another condition)
  _onDragOver: function(e) {
    var n = this.el, o = e.target, r, i, a, l = this.options, s = l.group, u = p.active, d = xe === s, c = l.sort, v = x || u, y, b = this, w = !1;
    if (it)
      return;
    function M(ye, Vt) {
      Y(ye, b, J({
        evt: e,
        isOwner: d,
        axis: y ? "vertical" : "horizontal",
        revert: a,
        dragRect: r,
        targetRect: i,
        canSort: c,
        fromSortable: v,
        target: o,
        completed: P,
        onMove: function(pt, $t) {
          return Xe(_, n, f, r, pt, N(pt), e, $t);
        },
        changed: k
      }, Vt));
    }
    function O() {
      M("dragOverAnimationCapture"), b.captureAnimationState(), b !== v && v.captureAnimationState();
    }
    function P(ye) {
      return M("dragOverCompleted", {
        insertion: ye
      }), ye && (d ? u._hideClone() : u._showClone(b), b !== v && (L(f, x ? x.options.ghostClass : u.options.ghostClass, !1), L(f, l.ghostClass, !0)), x !== b && b !== p.active ? x = b : b === p.active && x && (x = null), v === b && (b._ignoreWhileAnimating = o), b.animateAll(function() {
        M("dragOverAnimationComplete"), b._ignoreWhileAnimating = null;
      }), b !== v && (v.animateAll(), v._ignoreWhileAnimating = null)), (o === f && !f.animated || o === n && !o.animated) && (he = null), !l.dragoverBubble && !e.rootEl && o !== document && (f.parentNode[G]._isOutsideThisEl(e.target), !ye && fe(e)), !l.dragoverBubble && e.stopPropagation && e.stopPropagation(), w = !0;
    }
    function k() {
      W = z(f), re = z(f, l.draggable), R({
        sortable: b,
        name: "change",
        toEl: n,
        newIndex: W,
        newDraggableIndex: re,
        originalEvent: e
      });
    }
    if (e.preventDefault !== void 0 && e.cancelable && e.preventDefault(), o = q(o, l.draggable, n, !0), M("dragOver"), p.eventCanceled)
      return w;
    if (f.contains(e.target) || o.animated && o.animatingX && o.animatingY || b._ignoreWhileAnimating === o)
      return P(!1);
    if (We = !1, u && !l.disabled && (d ? c || (a = C !== _) : x === this || (this.lastPutMode = xe.checkPull(this, u, f, e)) && s.checkPut(this, u, f, e))) {
      if (y = this._getDirection(e, o) === "vertical", r = N(f), M("dragOverValid"), p.eventCanceled)
        return w;
      if (a)
        return C = _, O(), this._hideClone(), M("revert"), p.eventCanceled || (ce ? _.insertBefore(f, ce) : _.appendChild(f)), P(!0);
      var F = ct(n, l.draggable);
      if (!F || Ln(e, y, this) && !F.animated) {
        if (F === f)
          return P(!1);
        if (F && n === e.target && (o = F), o && (i = N(o)), Xe(_, n, f, r, o, i, e, !!o) !== !1)
          return O(), F && F.nextSibling ? n.insertBefore(f, F.nextSibling) : n.appendChild(f), C = n, k(), P(!0);
      } else if (F && Hn(e, y, this)) {
        var $ = ve(n, 0, l, !0);
        if ($ === f)
          return P(!1);
        if (o = $, i = N(o), Xe(_, n, f, r, o, i, e, !1) !== !1)
          return O(), n.insertBefore(f, $), C = n, k(), P(!0);
      } else if (o.parentNode === n) {
        i = N(o);
        var g = 0, D, j = f.parentNode !== n, I = !Xn(f.animated && f.toRect || r, o.animated && o.toRect || i, y), B = y ? "top" : "left", H = _t(o, "top", "top") || _t(f, "top", "top"), Z = H ? H.scrollTop : void 0;
        he !== o && (D = i[B], Ce = !1, Me = !I && l.invertSwap || j), g = Wn(e, o, i, y, I ? 1 : l.swapThreshold, l.invertedSwapThreshold == null ? l.swapThreshold : l.invertedSwapThreshold, Me, he === o);
        var Q;
        if (g !== 0) {
          var le = z(f);
          do
            le -= g, Q = C.children[le];
          while (Q && (h(Q, "display") === "none" || Q === m));
        }
        if (g === 0 || Q === o)
          return P(!1);
        he = o, Oe = g;
        var be = o.nextElementSibling, oe = !1;
        oe = g === 1;
        var Ne = Xe(_, n, f, r, o, i, e, oe);
        if (Ne !== !1)
          return (Ne === 1 || Ne === -1) && (oe = Ne === 1), it = !0, setTimeout(Bn, 30), O(), oe && !be ? n.appendChild(f) : o.parentNode.insertBefore(f, oe ? be : o), H && kt(H, 0, Z - H.scrollTop), C = f.parentNode, D !== void 0 && !Me && (ke = Math.abs(D - N(o)[B])), k(), P(!0);
      }
      if (n.contains(f))
        return P(!1);
    }
    return !1;
  },
  _ignoreWhileAnimating: null,
  _offMoveEvents: function() {
    E(document, "mousemove", this._onTouchMove), E(document, "touchmove", this._onTouchMove), E(document, "pointermove", this._onTouchMove), E(document, "dragover", fe), E(document, "mousemove", fe), E(document, "touchmove", fe);
  },
  _offUpEvents: function() {
    var e = this.el.ownerDocument;
    E(e, "mouseup", this._onDrop), E(e, "touchend", this._onDrop), E(e, "pointerup", this._onDrop), E(e, "touchcancel", this._onDrop), E(document, "selectstart", this);
  },
  _onDrop: function(e) {
    var n = this.el, o = this.options;
    if (W = z(f), re = z(f, o.draggable), Y("drop", this, {
      evt: e
    }), C = f && f.parentNode, W = z(f), re = z(f, o.draggable), p.eventCanceled) {
      this._nulling();
      return;
    }
    pe = !1, Me = !1, Ce = !1, clearInterval(this._loopId), clearTimeout(this._dragStartTimer), at(this.cloneId), at(this._dragStartId), this.nativeDraggable && (E(document, "drop", this), E(n, "dragstart", this._onDragStart)), this._offMoveEvents(), this._offUpEvents(), De && h(document.body, "user-select", ""), h(f, "transform", ""), e && (we && (e.cancelable && e.preventDefault(), !o.dropBubble && e.stopPropagation()), m && m.parentNode && m.parentNode.removeChild(m), (_ === C || x && x.lastPutMode !== "clone") && T && T.parentNode && T.parentNode.removeChild(T), f && (this.nativeDraggable && E(f, "dragend", this), et(f), f.style["will-change"] = "", we && !pe && L(f, x ? x.options.ghostClass : this.options.ghostClass, !1), L(f, this.options.chosenClass, !1), R({
      sortable: this,
      name: "unchoose",
      toEl: C,
      newIndex: null,
      newDraggableIndex: null,
      originalEvent: e
    }), _ !== C ? (W >= 0 && (R({
      rootEl: C,
      name: "add",
      toEl: C,
      fromEl: _,
      originalEvent: e
    }), R({
      sortable: this,
      name: "remove",
      toEl: C,
      originalEvent: e
    }), R({
      rootEl: C,
      name: "sort",
      toEl: C,
      fromEl: _,
      originalEvent: e
    }), R({
      sortable: this,
      name: "sort",
      toEl: C,
      originalEvent: e
    })), x && x.save()) : W !== ge && W >= 0 && (R({
      sortable: this,
      name: "update",
      toEl: C,
      originalEvent: e
    }), R({
      sortable: this,
      name: "sort",
      toEl: C,
      originalEvent: e
    })), p.active && ((W == null || W === -1) && (W = ge, re = Te), R({
      sortable: this,
      name: "end",
      toEl: C,
      originalEvent: e
    }), this.save()))), this._nulling();
  },
  _nulling: function() {
    Y("nulling", this), _ = f = C = m = ce = T = Ye = ie = ue = U = we = W = re = ge = Te = he = Oe = x = xe = p.dragged = p.ghost = p.clone = p.active = null, je.forEach(function(e) {
      e.checked = !0;
    }), je.length = Je = Ze = 0;
  },
  handleEvent: function(e) {
    switch (e.type) {
      case "drop":
      case "dragend":
        this._onDrop(e);
        break;
      case "dragenter":
      case "dragover":
        f && (this._onDragOver(e), kn(e));
        break;
      case "selectstart":
        e.preventDefault();
        break;
    }
  },
  /**
   * Serializes the item into an array of string.
   * @returns {String[]}
   */
  toArray: function() {
    for (var e = [], n, o = this.el.children, r = 0, i = o.length, a = this.options; r < i; r++)
      n = o[r], q(n, a.draggable, this.el, !1) && e.push(n.getAttribute(a.dataIdAttr) || jn(n));
    return e;
  },
  /**
   * Sorts the elements according to the array.
   * @param  {String[]}  order  order of the items
   */
  sort: function(e, n) {
    var o = {}, r = this.el;
    this.toArray().forEach(function(i, a) {
      var l = r.children[a];
      q(l, this.options.draggable, r, !1) && (o[i] = l);
    }, this), n && this.captureAnimationState(), e.forEach(function(i) {
      o[i] && (r.removeChild(o[i]), r.appendChild(o[i]));
    }), n && this.animateAll();
  },
  /**
   * Save the current sorting
   */
  save: function() {
    var e = this.options.store;
    e && e.set && e.set(this);
  },
  /**
   * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
   * @param   {HTMLElement}  el
   * @param   {String}       [selector]  default: `options.draggable`
   * @returns {HTMLElement|null}
   */
  closest: function(e, n) {
    return q(e, n || this.options.draggable, this.el, !1);
  },
  /**
   * Set/get option
   * @param   {string} name
   * @param   {*}      [value]
   * @returns {*}
   */
  option: function(e, n) {
    var o = this.options;
    if (n === void 0)
      return o[e];
    var r = Ae.modifyOption(this, e, n);
    typeof r != "undefined" ? o[e] = r : o[e] = n, e === "group" && Wt(o);
  },
  /**
   * Destroy
   */
  destroy: function() {
    Y("destroy", this);
    var e = this.el;
    e[G] = null, E(e, "mousedown", this._onTapStart), E(e, "touchstart", this._onTapStart), E(e, "pointerdown", this._onTapStart), this.nativeDraggable && (E(e, "dragover", this), E(e, "dragenter", this)), Array.prototype.forEach.call(e.querySelectorAll("[draggable]"), function(n) {
      n.removeAttribute("draggable");
    }), this._onDrop(), this._disableDelayedDragEvents(), Ge.splice(Ge.indexOf(this.el), 1), this.el = e = null;
  },
  _hideClone: function() {
    if (!ie) {
      if (Y("hideClone", this), p.eventCanceled)
        return;
      h(T, "display", "none"), this.options.removeCloneOnHide && T.parentNode && T.parentNode.removeChild(T), ie = !0;
    }
  },
  _showClone: function(e) {
    if (e.lastPutMode !== "clone") {
      this._hideClone();
      return;
    }
    if (ie) {
      if (Y("showClone", this), p.eventCanceled)
        return;
      f.parentNode == _ && !this.options.group.revertClone ? _.insertBefore(T, f) : ce ? _.insertBefore(T, ce) : _.appendChild(T), this.options.group.revertClone && this.animate(f, T), h(T, "display", ""), ie = !1;
    }
  }
};
function kn(t) {
  t.dataTransfer && (t.dataTransfer.dropEffect = "move"), t.cancelable && t.preventDefault();
}
function Xe(t, e, n, o, r, i, a, l) {
  var s, u = t[G], d = u.options.onMove, c;
  return window.CustomEvent && !ne && !Ie ? s = new CustomEvent("move", {
    bubbles: !0,
    cancelable: !0
  }) : (s = document.createEvent("Event"), s.initEvent("move", !0, !0)), s.to = e, s.from = t, s.dragged = n, s.draggedRect = o, s.related = r || e, s.relatedRect = i || N(e), s.willInsertAfter = l, s.originalEvent = a, t.dispatchEvent(s), d && (c = d.call(u, s, a)), c;
}
function et(t) {
  t.draggable = !1;
}
function Bn() {
  it = !1;
}
function Hn(t, e, n) {
  var o = N(ve(n.el, 0, n.options, !0)), r = 10;
  return e ? t.clientX < o.left - r || t.clientY < o.top && t.clientX < o.right : t.clientY < o.top - r || t.clientY < o.bottom && t.clientX < o.left;
}
function Ln(t, e, n) {
  var o = N(ct(n.el, n.options.draggable)), r = 10;
  return e ? t.clientX > o.right + r || t.clientX <= o.right && t.clientY > o.bottom && t.clientX >= o.left : t.clientX > o.right && t.clientY > o.top || t.clientX <= o.right && t.clientY > o.bottom + r;
}
function Wn(t, e, n, o, r, i, a, l) {
  var s = o ? t.clientY : t.clientX, u = o ? n.height : n.width, d = o ? n.top : n.left, c = o ? n.bottom : n.right, v = !1;
  if (!a) {
    if (l && ke < u * r) {
      if (!Ce && (Oe === 1 ? s > d + u * i / 2 : s < c - u * i / 2) && (Ce = !0), Ce)
        v = !0;
      else if (Oe === 1 ? s < d + ke : s > c - ke)
        return -Oe;
    } else if (s > d + u * (1 - r) / 2 && s < c - u * (1 - r) / 2)
      return Gn(e);
  }
  return v = v || a, v && (s < d + u * i / 2 || s > c - u * i / 2) ? s > d + u / 2 ? 1 : -1 : 0;
}
function Gn(t) {
  return z(f) < z(t) ? 1 : -1;
}
function jn(t) {
  for (var e = t.tagName + t.className + t.src + t.href + t.textContent, n = e.length, o = 0; n--; )
    o += e.charCodeAt(n);
  return o.toString(36);
}
function zn(t) {
  je.length = 0;
  for (var e = t.getElementsByTagName("input"), n = e.length; n--; ) {
    var o = e[n];
    o.checked && je.push(o);
  }
}
function Be(t) {
  return setTimeout(t, 0);
}
function at(t) {
  return clearTimeout(t);
}
Ue && S(document, "touchmove", function(t) {
  (p.active || pe) && t.cancelable && t.preventDefault();
});
p.utils = {
  on: S,
  off: E,
  css: h,
  find: Rt,
  is: function(e, n) {
    return !!q(e, n, e, !1);
  },
  extend: Cn,
  throttle: Yt,
  closest: q,
  toggleClass: L,
  clone: Bt,
  index: z,
  nextTick: Be,
  cancelNextTick: at,
  detectDirection: Lt,
  getChild: ve
};
p.get = function(t) {
  return t[G];
};
p.mount = function() {
  for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
    e[n] = arguments[n];
  e[0].constructor === Array && (e = e[0]), e.forEach(function(o) {
    if (!o.prototype || !o.prototype.constructor)
      throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));
    o.utils && (p.utils = J(J({}, p.utils), o.utils)), Ae.mount(o);
  });
};
p.create = function(t, e) {
  return new p(t, e);
};
p.version = _n;
var A = [], Ee, lt, st = !1, tt, nt, ze, Se;
function Un() {
  function t() {
    this.defaults = {
      scroll: !0,
      forceAutoScrollFallback: !1,
      scrollSensitivity: 30,
      scrollSpeed: 10,
      bubbleScroll: !0
    };
    for (var e in this)
      e.charAt(0) === "_" && typeof this[e] == "function" && (this[e] = this[e].bind(this));
  }
  return t.prototype = {
    dragStarted: function(n) {
      var o = n.originalEvent;
      this.sortable.nativeDraggable ? S(document, "dragover", this._handleAutoScroll) : this.options.supportPointer ? S(document, "pointermove", this._handleFallbackAutoScroll) : o.touches ? S(document, "touchmove", this._handleFallbackAutoScroll) : S(document, "mousemove", this._handleFallbackAutoScroll);
    },
    dragOverCompleted: function(n) {
      var o = n.originalEvent;
      !this.options.dragOverBubble && !o.rootEl && this._handleAutoScroll(o);
    },
    drop: function() {
      this.sortable.nativeDraggable ? E(document, "dragover", this._handleAutoScroll) : (E(document, "pointermove", this._handleFallbackAutoScroll), E(document, "touchmove", this._handleFallbackAutoScroll), E(document, "mousemove", this._handleFallbackAutoScroll)), At(), He(), In();
    },
    nulling: function() {
      ze = lt = Ee = st = Se = tt = nt = null, A.length = 0;
    },
    _handleFallbackAutoScroll: function(n) {
      this._handleAutoScroll(n, !0);
    },
    _handleAutoScroll: function(n, o) {
      var r = this, i = (n.touches ? n.touches[0] : n).clientX, a = (n.touches ? n.touches[0] : n).clientY, l = document.elementFromPoint(i, a);
      if (ze = n, o || this.options.forceAutoScrollFallback || Ie || ne || De) {
        ot(n, this.options, l, o);
        var s = ae(l, !0);
        st && (!Se || i !== tt || a !== nt) && (Se && At(), Se = setInterval(function() {
          var u = ae(document.elementFromPoint(i, a), !0);
          u !== s && (s = u, He()), ot(n, r.options, u, o);
        }, 10), tt = i, nt = a);
      } else {
        if (!this.options.bubbleScroll || ae(l, !0) === K()) {
          He();
          return;
        }
        ot(n, this.options, ae(l, !1), !1);
      }
    }
  }, te(t, {
    pluginName: "scroll",
    initializeByDefault: !0
  });
}
function He() {
  A.forEach(function(t) {
    clearInterval(t.pid);
  }), A = [];
}
function At() {
  clearInterval(Se);
}
var ot = Yt(function(t, e, n, o) {
  if (e.scroll) {
    var r = (t.touches ? t.touches[0] : t).clientX, i = (t.touches ? t.touches[0] : t).clientY, a = e.scrollSensitivity, l = e.scrollSpeed, s = K(), u = !1, d;
    lt !== n && (lt = n, He(), Ee = e.scroll, d = e.scrollFn, Ee === !0 && (Ee = ae(n, !0)));
    var c = 0, v = Ee;
    do {
      var y = v, b = N(y), w = b.top, M = b.bottom, O = b.left, P = b.right, k = b.width, F = b.height, $ = void 0, g = void 0, D = y.scrollWidth, j = y.scrollHeight, I = h(y), B = y.scrollLeft, H = y.scrollTop;
      y === s ? ($ = k < D && (I.overflowX === "auto" || I.overflowX === "scroll" || I.overflowX === "visible"), g = F < j && (I.overflowY === "auto" || I.overflowY === "scroll" || I.overflowY === "visible")) : ($ = k < D && (I.overflowX === "auto" || I.overflowX === "scroll"), g = F < j && (I.overflowY === "auto" || I.overflowY === "scroll"));
      var Z = $ && (Math.abs(P - r) <= a && B + k < D) - (Math.abs(O - r) <= a && !!B), Q = g && (Math.abs(M - i) <= a && H + F < j) - (Math.abs(w - i) <= a && !!H);
      if (!A[c])
        for (var le = 0; le <= c; le++)
          A[le] || (A[le] = {});
      (A[c].vx != Z || A[c].vy != Q || A[c].el !== y) && (A[c].el = y, A[c].vx = Z, A[c].vy = Q, clearInterval(A[c].pid), (Z != 0 || Q != 0) && (u = !0, A[c].pid = setInterval(function() {
        o && this.layer === 0 && p.active._onTouchMove(ze);
        var be = A[this.layer].vy ? A[this.layer].vy * l : 0, oe = A[this.layer].vx ? A[this.layer].vx * l : 0;
        typeof d == "function" && d.call(p.dragged.parentNode[G], oe, be, t, ze, A[this.layer].el) !== "continue" || kt(A[this.layer].el, oe, be);
      }.bind({
        layer: c
      }), 24))), c++;
    } while (e.bubbleScroll && v !== s && (v = ae(v, !1)));
    st = u;
  }
}, 30), zt = function(e) {
  var n = e.originalEvent, o = e.putSortable, r = e.dragEl, i = e.activeSortable, a = e.dispatchSortableEvent, l = e.hideGhostForTarget, s = e.unhideGhostForTarget;
  if (n) {
    var u = o || i;
    l();
    var d = n.changedTouches && n.changedTouches.length ? n.changedTouches[0] : n, c = document.elementFromPoint(d.clientX, d.clientY);
    s(), u && !u.el.contains(c) && (a("spill"), this.onSpill({
      dragEl: r,
      putSortable: o
    }));
  }
};
function dt() {
}
dt.prototype = {
  startIndex: null,
  dragStart: function(e) {
    var n = e.oldDraggableIndex;
    this.startIndex = n;
  },
  onSpill: function(e) {
    var n = e.dragEl, o = e.putSortable;
    this.sortable.captureAnimationState(), o && o.captureAnimationState();
    var r = ve(this.sortable.el, this.startIndex, this.options);
    r ? this.sortable.el.insertBefore(n, r) : this.sortable.el.appendChild(n), this.sortable.animateAll(), o && o.animateAll();
  },
  drop: zt
};
te(dt, {
  pluginName: "revertOnSpill"
});
function ht() {
}
ht.prototype = {
  onSpill: function(e) {
    var n = e.dragEl, o = e.putSortable, r = o || this.sortable;
    r.captureAnimationState(), n.parentNode && n.parentNode.removeChild(n), r.animateAll();
  },
  drop: zt
};
te(ht, {
  pluginName: "removeOnSpill"
});
p.mount(new Un());
p.mount(ht, dt);
function Vn(t) {
  return t == null ? t : JSON.parse(JSON.stringify(t));
}
function $n(t) {
  ft() && Jt(t);
}
function qn(t) {
  ft() ? Zt(t) : t();
}
const Nt = Symbol("cloneElement");
function Ut(...t) {
  var F, $;
  const e = (F = ft()) == null ? void 0 : F.proxy, n = t[0];
  let [, o, r] = t;
  Array.isArray(V(o)) || (r = o, o = null);
  let i = null;
  const {
    immediate: a = !0,
    clone: l = Vn,
    customUpdate: s
  } = ($ = V(r)) != null ? $ : {};
  function u(g) {
    var D;
    g.item[Nt] = l(V((D = V(o)) == null ? void 0 : D[g.oldIndex])), window.onDragStart = "aaa";
  }
  function d(g) {
    const D = g.item[Nt];
    pn(D) || ($e(g.item), hn(V(o), g.newDraggableIndex, D));
  }
  function c(g) {
    const { from: D, item: j, oldIndex: I, oldDraggableIndex: B, pullMode: H, clone: Z } = g;
    if (H === "clone") {
      wt(D, j, I), $e(Z);
      return;
    }
    dn(V(o), B);
  }
  function v(g) {
    if (s) {
      s(g);
      return;
    }
    const { from: D, item: j, oldIndex: I, oldDraggableIndex: B, newDraggableIndex: H } = g;
    if ($e(j), wt(D, j, I), Qt(o)) {
      const Z = [...V(o)];
      o.value = yt(
        Z,
        B,
        H
      );
      return;
    }
    yt(V(o), B, H);
  }
  const y = {
    onUpdate: v,
    onStart: u,
    onAdd: d,
    onRemove: c
  };
  function b(g) {
    const D = V(n);
    return g || (g = gn(D) ? mn(D, e == null ? void 0 : e.$el) : D), g && !yn(g) && (g = g.$el), g || un("Root element not found"), g;
  }
  function w() {
    var I;
    const B = (I = V(r)) != null ? I : {}, { immediate: g, clone: D } = B, j = Ve(B, ["immediate", "clone"]);
    return bn(
      o === null ? {} : y,
      j
    );
  }
  const M = (g) => {
    g = b(g), i && O.destroy(), i = new p(g, w());
  };
  Kt(
    () => r,
    () => {
      i && wn(w(), (g, D) => {
        i == null || i.option(g, D);
      });
    },
    { deep: !0 }
  );
  const O = {
    option: (g, D) => i == null ? void 0 : i.option(g, D),
    destroy: () => {
      i == null || i.destroy(), i = null;
    },
    save: () => i == null ? void 0 : i.save(),
    toArray: () => i == null ? void 0 : i.toArray(),
    closest: (...g) => i == null ? void 0 : i.closest(...g)
  }, P = () => O == null ? void 0 : O.option("disabled", !0), k = () => O == null ? void 0 : O.option("disabled", !1);
  return qn(() => {
    a && M();
  }), $n(O.destroy), se({ start: M, pause: P, resume: k }, O);
}
const ut = [
  "update",
  "start",
  "add",
  "remove",
  "choose",
  "unchoose",
  "end",
  "sort",
  "filter",
  "clone",
  "move",
  "change"
], Kn = [
  "animation",
  "ghostClass",
  "group",
  "sort",
  "disabled",
  "store",
  "handle",
  "draggable",
  "swapThreshold",
  "invertSwap",
  "invertedSwapThreshold",
  "removeCloneOnHide",
  "direction",
  "chosenClass",
  "dragClass",
  "ignore",
  "filter",
  "preventOnFilter",
  "easing",
  "setData",
  "dropBubble",
  "dragoverBubble",
  "dataIdAttr",
  "delay",
  "delayOnTouchOnly",
  "touchStartThreshold",
  "forceFallback",
  "fallbackClass",
  "fallbackOnBody",
  "fallbackTolerance",
  "fallbackOffset",
  "supportPointer",
  "emptyInsertThreshold",
  "scroll",
  "forceAutoScrollFallback",
  "scrollSensitivity",
  "scrollSpeed",
  "bubbleScroll",
  "modelValue",
  "tag",
  "target",
  ...ut.map((t) => `on${t.replace(/^\S/, (e) => e.toUpperCase())}`)
], eo = en({
  name: "VueDraggable",
  model: {
    prop: "modelValue",
    event: "update:modelValue"
  },
  props: Kn,
  emits: ["update:modelValue", ...ut],
  setup(t, { slots: e, emit: n, expose: o }) {
    const r = tn(), i = ut.reduce((d, c) => {
      const v = `on${c.replace(/^\S/, (y) => y.toUpperCase())}`;
      return d[v] = (y) => n(c, y), d;
    }, {}), a = bt(() => {
      const y = nn(t), { modelValue: d } = y, c = Ve(y, ["modelValue"]), v = Object.entries(c).reduce((b, [w, M]) => {
        const O = V(M);
        return O !== void 0 && (b[w] = O), b;
      }, {});
      return se(se({}, i), cn(se(se({}, r), v)));
    });
    t.modelValue.length > 4 && console.log("options", a, t);
    const l = bt({
      get: () => t.modelValue,
      set: (d) => n("update:modelValue", d)
    }), s = on(), u = rn(
      Ut(t.target || s, l, a)
    );
    return o(u), () => {
      if (e.default)
        return an(t.tag || "div", { ref: s }, e.default(u));
    };
  }
}), Pt = {
  mounted: "mounted",
  unmounted: "unmounted"
}, rt = /* @__PURE__ */ new WeakMap(), to = {
  [Pt.mounted](t, e) {
    const n = ln(e.value) ? [e.value] : e.value, o = Ut(t, ...n);
    rt.set(t, o.destroy);
  },
  [Pt.unmounted](t) {
    var e;
    (e = rt.get(t)) == null || e(), rt.delete(t);
  }
};
export {
  eo as VueDraggable,
  Ut as useDraggable,
  to as vDraggable
};
